Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
is not assignable to parameter of type [React]

I have problem in react I wrote enum type

enum.ts

export enum DivingType {
  FreeDiving = "FreeDiving",
  ScubaDiving = "ScubaDiving",
}

and my home screen has graphql hooks

home.tsx

import { DivingType } from "..."

export const Home = () => {
  const [divingType, setDivingType] = useState<DivingType>(DivingType.FreeDiving)
  const [pageNumber, setPageNumber] = useState(1)

  useMatchingList(divingType, pageNumber)
  
  // --------------------[ Return ]--------------------
  return ...

useMatchingList.tsx

interface IUseMatchingListProps {
  divingType: DivingType
  pageNumber: number
}
export const useMatchingList: React.FC<IUseMatchingListProps> = ({
  divingType,
 ,
}) => {...}

and I have

Argument of type 'import("...").DivingType' is not assignable to parameter of type 'PropsWithChildren<IUseMatchingListProps>'

useMatchingList(divingType, pageNumber)
       |            ^

what is the matter ? please help me !

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The FC in React.FC means "Functional Component". And a hook is not a component. A custom hook is just a function that calls other hooks. So it takes arguments just like any function would.

That means your hooks should look more like this:

export const useMatchingList = (divingType: DivingType, pageNumber: number) => {
  // my hook implementation
}

Working typesafe example

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda